﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.CopsBanditsUI {
    import flash.events.*;
    import flash.geom.*;
    import org.aswing.*;
    import Classes.*;
    import Classes.util.*;
    import Modules.workers.*;
    import flash.filters.*;
    import Display.FactoryUI.*;
    import flash.text.*;
    import Display.aswingui.*;
    import Engine.*;

    public class CopSlidePick extends SlidePick {

        protected const PICK_OFFSET:Point;

        protected var m_npc:NPC;
        protected var m_data:CopData;
        protected var m_toolTip:AssetPane;

        public function CopSlidePick(_arg1:NPC, _arg2:CopData){
            var _local6:Player;
            this.PICK_OFFSET = new Point(-35, -110);
            this.m_npc = _arg1;
            this.m_data = _arg2;
            var _local3:String = _arg2.getZID().substr(1);
            var _local4:Array = Global.player.friends;
            var _local5:String;
            for each (_local6 in _local4) {
                if (_local6.uid == _local3){
                    _local5 = _local6.snUser.picture;
                    break;
                };
            };
            if ((((_local5 == null)) || ((_local5.length == 0)))){
                _local5 = Global.getAssetURL("assets/dialogs/citysam_neighbor_card.jpg");
            };
            var _local7:Player = Global.player.findFriendById(GameUtil.formatServerUid(_arg2.getZID()));
            if (!_local7){
                _local7 = Global.player.findFriendById("-1");
            };
            var _local8:String = ZLoc.t("Bandits", "Officer_Title", {officerName:(_local7) ? _local7.firstName : "Sam"});
            this.m_toolTip = ASwingHelper.makeMultilineText(_local8, 500, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.CENTER, 14, EmbeddedArt.whiteTextColor, [new GlowFilter(0, 1, 4, 4, 10, BitmapFilterQuality.LOW)]);
            this.m_toolTip.mouseChildren = false;
            this.m_toolTip.mouseEnabled = false;
            super(_local5);
            m_tween.kill();
            this.m_toolTip.x = (((-(this.m_toolTip.width) / 2) + (this.m_mainSprite.width / 2)) + 5);
            this.m_toolTip.y = -((this.m_toolTip.height + 10));
            this.m_toolTip.visible = false;
            addChild(this.m_toolTip);
        }
        public function set owner(_arg1:NPC):void{
            this.m_npc = _arg1;
        }
        public function get owner():NPC{
            return (this.m_npc);
        }
        override public function setPosition(_arg1:Number, _arg2:Number):void{
            var _local3:Point = IsoMath.tilePosToPixelPos(_arg1, _arg2);
            _local3 = IsoMath.viewportToStage(_local3);
            this.x = (_local3.x + this.PICK_OFFSET.x);
            this.y = (_local3.y + this.PICK_OFFSET.y);
        }
        override protected function onIconLoaded(_arg1:Event):void{
            super.onIconLoaded(_arg1);
            m_asset.y = (m_asset.y - 5);
        }
        public function hideText():void{
            this.m_toolTip.visible = false;
        }
        public function showText():void{
            this.m_toolTip.visible = true;
        }

    }
}//package Display.CopsBanditsUI 
